pub fn convert_base(num_str: &str, to_base: u32) -> String {
    let left = num_str.find('(').unwrap();
    let right = (&num_str[left + 1..]).find(')').unwrap() + left + 1;

    let from_base = (&num_str[left + 1..right]).parse::<u32>().unwrap();
    let mut num = 0;
    for ch in (&num_str[..left]).chars() {
        num = num * from_base + ch.to_digit(from_base).unwrap();
    }

    let mut result = String::new();
    while num > 0 {
        result.push(char::from_digit(num % to_base, to_base).unwrap());
        num /= to_base;
    }

    result.chars().rev().collect()
}
